<extend name="common:commonNewerTemplate" />
<block name="main_content">
<div id="content">
	<div id="content-header">
		<div id="breadcrumb">
			<a class="tip-bottom" href="index.html"
				data-original-title="Go to Home"><i class="icon-home"></i> 首页</a> <a
				href="#">订单管理</a> <a class="current" href="#">订单详情</a>
		</div>

	</div>
	<div class="container-fluid">
		<div class="row-fluid">
			<div class="span5">
				<div class="widget-box">
					<div class="widget-title">
						<span class="icon"> <i class="icon-info-sign"></i></span>
						<h5>订单详情</h5>
						<!-- <if condition="($order_info_en.order_status neq 51) AND ($order_info_en.order_status neq 52) AND ($order_info_en.order_status neq 53) ">
						 <input id="btn_order_cancell" type="button" class="btn btn-success" onclick="orderCancel('{$order_info_en.order_id}')" value="取消订单">
						</if> -->
						<in name="order_info_en.order_status" value="10,11,12,14,15,21,22,23">
						<input id="btn_order_cancell" type="button" class="btn btn-danger" onclick="orderCancel('{$order_info_en.order_id}')" value="取消订单">
						</in>
						
						<if condition="(($order_info_en.payment_type eq 4 ) AND ($order_info_en.order_status eq 10)) OR ($order_info_en.order_status eq 23)">
							<input id="btn_search" type="button" class="btn btn-success" onclick="upload()" value="付款凭证上传">			
						</if>
						 
					</div>
					<div class="widget-content nopadding">
						<form novalidate="novalidate" id="basic_validate"
							name="basic_validate" action="#" method="post" class="form-horizontal">
							<div class="control-group">
								<input type="hidden" id="order_id" name="order_id" value="{$order_info_en.order_id}">
								<label class="control-label">订单编号：</label><label
									style="text-align: left;" class="control-label">
									<span id="order_id">{$order_info_en.order_id}</span></label>
							</div>
							<div class="control-group">
								<label class="control-label">订单状态：</label><label
									style="text-align: left;" class="control-label">
									<span id="order_status">{$order_info_en.order_status_text}</span>
									</label>
							</div>
							<div class="control-group">
								<label class="control-label">订单类型：</label><label
									style="text-align: left;" class="control-label">
									<span id="order_type_text">{$order_info_en.order_type_text}</span></label>
							</div>
							<div class="control-group">
								<label class="control-label">经销商名称：</label><label
									style="text-align: left;" class="control-label">
									<span id="order_type_text">{$order_info_en.buyer_name}</span></label>
							</div>
							<div class="control-group">
								<label class="control-label">下单人：</label><label
									style="text-align: left;" class="control-label">
									<span id="order_type_text">{$order_info_en.seller_name}</span></label>
							</div>
							<div class="control-group">
								<label class="control-label">支付方式：</label><label
									style="text-align: left;" class="control-label">
									<span id="order_type_text">{$order_info_en.payment_method_text}</span></label>
							</div>
							<!-- <div class="control-group">
								<label class="control-label">卖家昵称：</label><label
									style="text-align: left;" class="control-label">
									<span id="order_id">{$order_info_en.seller_nick}</span></label>
							</div>
							<div class="control-group">
								<label class="control-label">卖家联系方式：</label><label
									style="text-align: left;" class="control-label">
									<span id="order_id">{$order_info_en.seller_mobile}</span></label>
							</div> -->
							<div class="control-group">
								<label class="control-label">商品总数量：</label><label
									style="text-align: left;" class="control-label">
									<span id="goods_qty">{$order_info_en.goods_qty}</span></label>
							</div>
							
							<div class="control-group">
								<label class="control-label">已发货数量：</label><label
									style="text-align: left;" class="control-label">
									<span id="ship_qty">{$order_info_en.ship_qty}</span></label>
							</div>
							<div class="control-group">
								<label class="control-label">实付金额：</label><label
									style="text-align: left;" class="control-label">
									<span id="actual_payment">{$order_info_en.actual_payment}</span></label>
							</div>
							<div class="control-group">
								<label class="control-label">应付金额：</label><label
									style="text-align: left;" class="control-label">
									<span id="payment_amount">{$order_info_en.payment_amount}</span></label>
							</div>
							<div class="control-group">
								<label class="control-label">运费：</label><label
									style="text-align: left;" class="control-label">
									<span id="freight">{$order_info_en.freight}</span></label>
							</div>
							<div class="control-group">
								<label class="control-label">VR渠道经销商价格上浮：</label><label
									style="text-align: left;" class="control-label">
									<span id="discount_amount">{$discount_amount}</span></label>
							</div>
							<div class="control-group">
								<label class="control-label">订单优惠金额：</label><label
									style="text-align: left;" class="control-label">
									<span id="discount_fee">{$order_info_en.discount_fee}</span></label>
							</div>
							<div class="control-group">
								<label class="control-label">订单总金额：</label><label
									style="text-align: left;" class="control-label">
									<span id="order_amount">{$order_info_en.order_amount}</span></label>
							</div>
							<div class="control-group">
								<label class="control-label">订单备注：</label><label
									style="text-align: left;" class="control-label">
									<span id="order_amount">{$order_info_en.buyer_message}</span></label>
							</div>
							<if condition="$order_payment_en.payment_voucher neq '' ">
								<div class="control-group">
									<label class="control-label">支付凭证：</label>
									<a target="_blank" href="/Public/Uploads/{$order_payment_en.payment_voucher}"><img src="/Public/Uploads/{$order_payment_en.payment_voucher}" id="display_images"></a>
								</div>
							</if>
							<div class="form-actions">
							<if condition="$order_info_en.order_status eq 23">
							<a   href="#" onclick="dealersalseManagerAudit('{$order_info_en.order_id}')" style="background:red" class="btn btn-success" >销售管理部审批</a>
							<elseif condition="$order_info_en.order_status eq 14"/>
							<a   href="#" onclick="dealerfinanceAudit('{$order_info_en.order_id}')" style="background:red" class="btn btn-success" >财务经理审批</a>			
							<else />
							</if>
							
							</div>
							
						</form>
					</div>
				</div>
			</div>


			<div class="span7">
				<div class="widget-box">
					<div class="widget-title">
						<span class="icon"> <i class="icon-th"></i>
						</span>
						<h5>
							订单<span style="color: red">{$order_info_en.order_id}</span> 订单明细
						</h5>
						<if condition="(($order_info_en.payment_type eq 3) AND (($order_info_en.order_status  eq 10 ) OR($order_info_en.order_status  eq 22 ) OR ($order_info_en.order_status  eq 33 ) )) OR ($order_info_en.order_status eq 22) OR ($order_info_en.order_status eq 33)">
						 <input id="btn_order_deliver" type="button" class="btn btn-success" onclick="orderDeliver('{$order_info_en.order_id}')" value="全部发货">
						</if>
					</div>
					<div class="widget-content nopadding">
						<table class="table table-bordered table-striped"
							id="search_result" page_index="1">
							<thead>
								<tr>
									<th>订单编号</th>
									<th>商品名称</th>
									<th>sku_id</th>
									<th>购买数量</th>
									<th>单价</th>
									<th>购买价</th>
									<th>已发货数量</th> 
									<th>实付金额</th>
									<th>操作</th>
								</tr>
							</thead>
							<tbody>
								<volist id="order_detail_en" name="order_detail_en">
								<tr class="odd gradeX">
									<td>{$order_detail_en.order_id}</td>
									<td>{$order_detail_en.sku_properties_name}</td>
									<td>{$order_detail_en.sku_id}</td>
									<td>{$order_detail_en.qty}</td>
									<td>{$order_detail_en.sale_price}</td>
									<td>{$order_detail_en.goods_payment_amount}</td>
									<td>{$order_detail_en.ship_qty}</td>
									<td>{$order_detail_en.payment_amount}</td>
									<if condition="(($order_info_en.payment_type eq 3) AND (($order_info_en.order_status  eq 10 ) OR($order_info_en.order_status  eq 22 ) OR ($order_info_en.order_status  eq 33 ))) OR ($order_info_en.order_status eq 22)  OR ($order_info_en.order_status eq 33) ">
						            <compare  name="order_detail_en.qty" value="$order_detail_en.ship_qty" type="gt">
									<td>							
			                			 <input id="btn_order_deliver_part" type="button" class="btn btn-success" onclick="orderDeliverPart('{$order_info_en.order_id}','{$order_detail_en.oid}')" value="发货">
									</td>
									<else/>
									<td>已完成</td>
									</compare>
						             <else/>
						             <td></td>
						             </if>
									
								</tr>
								</volist>
							</tbody>
						</table>
					</div>
				</div>
			</div>
			
			
			
			
			<div class="span7">
				<div class="widget-box">
					<div class="widget-title">
						<span class="icon"> <i class="icon-th"></i>
						</span>
						<h5>
							订单<span style="color: red">{$order_info_en.order_id}</span> 订单发货详情
						</h5>
						
					</div>
					<div class="widget-content nopadding">
						<table class="table table-bordered table-striped"
							id="search_result" page_index="1">
							<thead>
								<tr>
									<th>订单编号</th>
									<th>发货数量</th>
									<th>物流名称</th>
									<th>物流单号</th>
									<th>发货仓</th>
									<th>备注</th>														
								</tr>
							</thead>
							<tbody>
							<empty name="order_consign_en">
							<tr class="odd gradeX" >
							<td colspan='6' style='text-align:center'>暂无数据！</td>
							</tr>
							
							</empty>
							<else>
								<volist id="order_consign" name="order_consign_en">
								<tr class="odd gradeX">
									<td>{$order_consign.order_id}</td>
									<td>{$order_consign.ship_qty}</td>
									<td>{$order_consign.logistic_name}</td>
									<td>{$order_consign.express_no}</td>
									<td>{$order_consign.shipping_warehouse}</td>
									<td>{$order_consign.remark}</td>
								</tr>
								</volist>
								</else>
							</tbody>
						</table>
					</div>
				</div>
			</div>
			
			
			
			
			<div class="span7">
				<div class="widget-box">
					<div class="widget-title">
						<span class="icon"> <i class="icon-th"></i>
						</span>
						<h5>
							订单<span style="color: red">{$order_info_en.order_id}</span> 订单状态详情
						</h5>
						
					</div>
					<div class="widget-content nopadding">
						<table class="table table-bordered table-striped"
							id="search_result" page_index="1">
							<thead>
								<tr>
									
									<th>订单状态</th>									
									<th>更改日期</th>
									<th>备注</th>														
								</tr>
							</thead>
							<tbody>
							<empty name="order_change_log_en">
							<tr class="odd gradeX" >
							<td colspan='3' style='text-align:center'>暂无数据！</td>
							</tr>
							
							</empty>
							<else>
								<volist id="order_change_log" name="order_change_log_en">
								<tr class="odd gradeX">
									<td>{$order_change_log.order_status_text}</td>
									<td>{$order_change_log.create_date}</td>
									<td>{$order_change_log.remark}</td>
									
								</tr>
								</volist>
								</else>
							</tbody>
						</table>
					</div>
				</div>
			</div>
			
			
			
		</div>
	</div>
</div>
</block>


<block name="js_content">
<script>
	 function upload(){
		var docHeight = document.documentElement.clientHeight;
		layer.open({
			type: 2,
		    title: '附件上传',
	        fix: true,
	        shadeClose: true,
	        maxmin: true,
	        offset:[(docHeight/2-240)+'px' , ''],
            area : ['auto','450px'],
	        content: '/VRDealer/paymentVoucherUpload?order_id={$order_info_en.order_id}',
	        end: function(){
	            layer.tips('完成选择', '#photosDemo', {tips: 1})
	            window.location.reload();
	        }
	    });
	}
	 
	 
	 function dealersalseManagerAudit(index){	 
		var docHeight = document.documentElement.clientHeight;
		 layer.open({
				type: 2,
			    title: '销售管理部审批',
		        fix: true,
		        shadeClose: true,
		        maxmin: true,
		        offset:[(docHeight/2-240)+'px' , ''],
	            area : ['auto','450px'],
		        content: '/VRDealer/dealersalseManagerAudit?audit_type=14&order_id='+index,
		        end: function(){
		            layer.tips('完成选择', '#photosDemo', {tips: 1})
		            window.location.reload();
		        }
		    }); 
	 }
	 
	 function dealerfinanceAudit(index){
		 
		var docHeight = document.documentElement.clientHeight;
		 layer.open({
				type: 2,
			    title: '财务部审批',
		        fix: true,
		        shadeClose: true,
		        maxmin: true,
		        offset:[(docHeight/2-240)+'px' , ''],
	            area : ['auto','450px'],
		        content: '/VRDealer/dealerfinanceAudit?audit_type=15&order_id='+index,
		        end: function(){
		            layer.tips('完成选择', '#photosDemo', {tips: 1})
		            window.location.reload();
		        }
		    }); 
		 
	 }
	 
	function  orderCancel(index){
		var docHeight = document.documentElement.clientHeight;
		 layer.open({
				type: 2,
			    title: '订单取消',
		        fix: true,
		        shadeClose: true,
		        maxmin: true,
		        offset:[(docHeight/2-240)+'px' , ''],
	            area : ['auto','450px'],
		        content: '/order/orderCancelConfirm?order_id='+index,
		        end: function(){
		            layer.tips('完成选择', '#photosDemo', {tips: 1})
		            window.location.reload();
		        }
		    }); 
		 
	}
	
	function  orderDeliver(index){
		
		 layer.open({
				type: 2,
			    title: '订单发货操作',
		        fix: true,
		        shadeClose: true,
		        maxmin: true,
		        area: ['1000px', '500px'],
		        content: '/VRDealer/partofexpressdetail?order_id='+index,
		        end: function(){
		            layer.tips('完成选择', '#photosDemo', {tips: 1})
		            window.location.reload();
		        }
		    }); 
		 
	}
	
	function  orderDeliverPart(order_id,oid){
		
		 layer.open({
				type: 2,
			    title: '订单发货操作',
		        fix: true,
		        shadeClose: true,
		        maxmin: true,
		        area: ['1000px', '500px'],
		        content: '/VRDealer/partofexpressdetail?order_id='+order_id+"&oid="+oid,
		        end: function(){
		            layer.tips('完成选择', '#photosDemo', {tips: 1})
		            window.location.reload();
		        }
		    }); 
		 
	}
	
	
	
	
	 function update_order_status(){
		 	var order_id = $('#order_id').val();
			var result = OrderService.UpdateOrderStatus(order_id);
			if (result.IsSuccess == 0) {
				alert(result.ErrorMsg);
				return;
			} else {
				if(result.Result !=null){
					alert(result.Result);
				}
				window.location.reload();
			}
	 }
</script>
<script src="/Public/js/layer/layer.js"></script>
</block>
